package com.fulong.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.fulong.entity.SysMeunNagEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fulong.entity.SysMeunNagEntity;
import com.fulong.service.SysMeunNagService;
import com.fulong.common.utils.PageUtils;
import com.fulong.common.utils.R;



/**
 * 
 *
 * @author fulong
 * @email ${email}
 * @date 2022-03-20 09:26:24
 */
@RestController
@RequestMapping("/sysmeunnag")
public class SysMeunNagController {
    @Autowired
    private SysMeunNagService sysMeunNagService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        List<SysMeunNagEntity> list = sysMeunNagService.withTree();
        return R.ok().put("data", list);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
		SysMeunNagEntity sysMeunNag = sysMeunNagService.getById(id);

        return R.ok().put("sysMeunNag", sysMeunNag);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody SysMeunNagEntity sysMeunNag){
		sysMeunNagService.save(sysMeunNag);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody SysMeunNagEntity sysMeunNag){
		sysMeunNagService.updateById(sysMeunNag);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] ids){
		sysMeunNagService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
